return result;
}
-
-/* Like g_module_path, but use .la as the suffix
- */
-static gchar*
-module_build_la_path (const gchar *directory,
- const gchar *module_name)
-{
- gchar *filename;
- gchar *result;
-
- if (strncmp (module_name, "lib", 3) == 0)
- filename = (gchar *)module_name;
- else
- filename = g_strconcat ("lib", module_name, ".la", NULL);
-
- if (directory && *directory)
- result = g_build_filename (directory, filename, NULL);
- else
- result = g_strdup (filename);
-
- if (filename != module_name)
- g_free (filename);
-
- return result;
-}
-
-/**
- * _gtk_find_module:
- * @name: the name of the module
- * @type: the type of the module, for instance 'modules', 'engines', immodules'
- *
- * Looks for a dynamically module named @name of type @type in the standard GTK+
- * module search path.
- *
- * Returns: the pathname to the found module, or %NULL if it wasn’t found.
- * Free with g_free().
- **/
-gchar *
-_gtk_find_module (const gchar *name,
- const gchar *type)
-{
- gchar **paths;
- gchar **path;
- gchar *module_name = NULL;
-
- if (g_path_is_absolute (name))
- return g_strdup (name);
-
- paths = _gtk_get_module_path (type);
- for (path = paths; *path; path++)
- {
- gchar *tmp_name;
-
- tmp_name = g_module_build_path (*path, name);
- if (g_file_test (tmp_name, G_FILE_TEST_EXISTS))
- {
- module_name = tmp_name;
- goto found;
- }
- g_free(tmp_name);
-
- tmp_name = module_build_la_path (*path, name);
- if (g_file_test (tmp_name, G_FILE_TEST_EXISTS))
- {
- module_name = tmp_name;
- goto found;
- }
- g_free(tmp_name);
- }
-
- found:
- g_strfreev (paths);
- return module_name;
-}